package com.example.module_enterprise.vm

import androidx.lifecycle.MutableLiveData
import com.yuwei.base.BaseViewModel
import com.yuwei.http.ApiService
import com.yuwei.http.entity.EnterpriseDetailEntity
import com.yuwei.http.entity.EnterpriseEntity
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class EnterpriseViewModel @Inject constructor(
    val apiService: ApiService
):BaseViewModel(){
    val getEnterpriseSuccess by lazy { MutableLiveData<EnterpriseEntity>() }
    fun getEnterpriseList(){
        executeNetwork({
            apiService.getEnterprise()
        },getEnterpriseSuccess::postValue)
    }
    val getDetailEnterpriseSuccess by lazy { MutableLiveData<EnterpriseDetailEntity>() }
    fun getDetailEnterpriseList(id:Int){
        executeNetwork({
            apiService.getEnterpriseId(id)
        },getDetailEnterpriseSuccess::postValue)
    }
}